'''
Author: didiplus
Date: 2024-10-18 11:56:17
LastEditTime: 2024-10-18 12:00:39
LastEditors: didiplus
Description: 
FilePath: \pythonscript\python\趣学Python算法100例\18、猜牌术\demo.py
'''
def find_initial_order():
    # 最终的顺序
    final_order = list(range(1, 14))  # 黑桃A到黑桃K
    current_order = []
    
    # 逆向推导
    for i in range(13):
        current_order.insert(0, final_order[-1])  # 将当前已知的最后一张放在顶部
        final_order.pop()  # 去掉最后一张

        # 模拟放回牌的过程
        if current_order:
            current_order.insert(0, current_order.pop())  # 将最上面的一张牌放到底部

    return current_order

initial_order = find_initial_order()
print("原始牌的顺序是:", initial_order)







